package com.example.music.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ZCL
 * @date 2022/1/26 17:31
 * @Version 1.0
 */
@Data
@AllArgsConstructor
public class RespBean {
    private long code;
    private String message;
    private Object object;

    public RespBean(){

    }

    /**
     * 成功返回结果
     * @param message
     */
    public static RespBean success(String message){
        return new RespBean(200,message,null);
    }
    /**
     * 成功返回结果
     * @param message
     * @param data
     * @return
     */
    public static RespBean success(String message,Object data){
        return new RespBean(200,message,data);
    }
    /**
     * 失败返回结果
     * @param message
     * @return
     */
    public static RespBean error(String message){
        return new RespBean(500,message,null);
    }

    /**
     *
     * @param message
     * @param data
     * @return
     */
    public static RespBean error(String message,Object data){
        return new RespBean(500,message,data);
    }

}
